package com.bjpowernode.ba02;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @Value:简单类型的赋值
 * 属性: value 是String类型的,标示简单类型的赋值
 * 位置: 1.在属性定义的上面,无需set方法,推荐使用.
 *      2.在set方法上面
 */
@Component(value = "myStudent02")
public class Student {
    @Value("张飞")
    private String name;
    @Value("29")
    private Integer age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }
    @Value("32")
    public void setAge(Integer age) {
        this.age = age;
    }

    public Student(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public Student() {
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

}
